const mongoose = require('mongoose')

const userSchema = mongoose.Schema({
  nickname: String,
  email: String,
  password: String,
  phone: String,
  openid: String,
  integral: Number, // 积分
  sex: {
    type: String,
    default: '秘密'
  },
  avatar: {
    type: String, 
    default: ''
  },
  createAt: {
    type: Date,
    default: new Date()
  },
  lastUpdate: {
    type: Date,
    default: new Date()
  },
  lastOnline: {
    type: Date,
    default: new Date()
  },
  place: {
    type: String,
    default: '中国'
  }
})

module.exports = mongoose.model('user', userSchema)
